package org.wu.framework.lazy.orm.database.lambda.stream.condition.as;

import org.wu.framework.lazy.orm.database.lambda.stream.condition.BasicComparison;
import org.wu.framework.lazy.orm.database.lambda.stream.condition.LambdaJoinBasicComparison;
import org.wu.framework.lazy.orm.database.lambda.stream.function.Snippet;

public interface FunctionAsComparison<T, C extends FunctionAsComparison<T, C>> {


    /**
     * 查询指定列
     *
     * @param <T1>
     * @param row        列
     * @param comparison
     * @return
     */
    <T1> C select(Snippet<T1, ?> row, BasicComparison<T1, ?, ?, ?> comparison);


    /**
     * 动态sql
     *
     * @param sql
     * @param <T1>
     * @return
     */
    <T1> C sqlFunction(String sql);

    /**
     * 统计数据
     *
     * @param snippet
     * @param <T1>
     * @return
     */
    <T1> C count(Snippet<T1, ?> snippet);

    /**
     * 获取和集
     *
     * @param snippet
     * @param <T1>
     * @return
     */
    <T1> C sum(Snippet<T1, ?> snippet);

    /**
     * 获取最大值
     *
     * @param snippet
     * @param <T1>
     * @return
     */
    <T1> C max(Snippet<T1, ?> snippet);

    /**
     * 获取最小值
     *
     * @param snippet
     * @param <T1>
     * @return
     */
    <T1> C min(Snippet<T1, ?> snippet);

    /**
     * 获取sql函数片段
     *
     * @return
     */
    public String getFunctionFragment();

}
